import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

export enum ClerkStatus {
  ONLINE = 'online',
  HIDDEN = 'hidden',
  OFFLINE = 'offline',
}

@Entity('tb_clerk', {
  comment: '客服表',
})
export class Clerk {
  @PrimaryGeneratedColumn('increment', { comment: '自增主键', unsigned: true })
  id: number;

  @Column({ comment: '手机号码', unique: true, type: 'char', length: 11 })
  phone: string;

  @Column({ comment: '登录密码', type: 'char', length: 60 })
  password: string;

  @Column({ comment: '头像地址', nullable: true })
  avatar: string;

  @Column({ comment: '用户昵称', nullable: true })
  nickname: string;

  @Column({ comment: '状态', default: ClerkStatus.OFFLINE })
  status: ClerkStatus;

  @Column({ comment: '创建时间' })
  created: Date;
}
